package rulebase;

import java.awt.CardLayout;
import java.awt.event.ActionListener;

import javax.swing.DefaultComboBoxModel;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JPanel;

public class SpelloutRulePanel extends JPanel
{	
	private JPanel pnlSeven =  new SimpleSpelloutRulePanel();
	private JPanel pnlEight = new TableSpelloutRulePanel();
	private JPanel pnlNine = new MorphophoneticSpelloutRulePanel();
	private JPanel pnlThirteen = new FormSelectionPanel();
	
	private JPanel pnlSix;

	private JComboBox cbxType;
	
	public SpelloutRulePanel()
	{
		setLayout(null);
		initGUI();
	}
	
	private void initGUI()
	{
		pnlSix = new JPanel();
		pnlSix.setBounds(10, 36, 444, 421);
		add(pnlSix);
		pnlSix.setLayout(new CardLayout(0, 0));
		
		JLabel lblType = new JLabel("Type");
		lblType.setBounds(10, 11, 46, 14);
		add(lblType);
		
		cbxType = new JComboBox();
		cbxType.setBounds(77, 8, 150, 20);
		add(cbxType);
		initCbxTypeItems();
		
		pnlSix.add(pnlSeven,"Simple");
		pnlSix.add(pnlEight,"Table");
		pnlSix.add(pnlNine,"Morphophonetic");
		pnlSix.add(pnlThirteen,"Form Selection");
	}
	
	private void initCbxTypeItems()
	{
		DefaultComboBoxModel model = new DefaultComboBoxModel();
		model.addElement("Simple");
		model.addElement("Table");
		model.addElement("Morphophonetic");
		model.addElement("Form Selection");
		cbxType.setModel(model);
	}
	
	public String getCbxTypeSelectedItem()
	{
		return (String)cbxType.getSelectedItem();
	}
	
	public void setCbxTypeSelectedItem(String s)
	{
		cbxType.setSelectedItem(s);
	}
	
	public JPanel getPnlSix() 
	{
		return pnlSix;
	}

	public void setPnlSix(JPanel pnlSix) 
	{
		this.pnlSix = pnlSix;
	}
	
	public JPanel getPnlSeven() 
	{
		return pnlSeven;
	}

	public void setPnlSeven(JPanel pnlSeven) 
	{
		this.pnlSeven = pnlSeven;
	}

	public JPanel getPnlEight() 
	{
		return pnlEight;
	}

	public void setPnlEight(JPanel pnlEight) 
	{
		this.pnlEight = pnlEight;
	}

	public JPanel getPnlNine() 
	{
		return pnlNine;
	}
	
	public void setPnlNine(JPanel pnlNine) 
	{
		this.pnlNine = pnlNine;
	}

	public JPanel getPnlThirteen() 
	{
		return pnlThirteen;
	}

	public void setPnlThirteen(JPanel pnlThirteen) 
	{
		this.pnlThirteen = pnlThirteen;
	}
	
	public void setCbxTypeActionListener(ActionListener AL)
	{
		cbxType.addActionListener(AL);
	}
}
